/*** 
 * @Author: Colin Dai
 * @Date: 2022-05-10 18:08:46
 * @LastEditors: Colin Dai
 * @LastEditTime: 2022-05-10 18:20:37
 * @FilePath: /jy-uos/src/softbus/communication/udp/include/udp_socket.h
 * @Description: 
 * @dailianzheng@163.com
 * @Copyright (c) 2022 by Colin.Dai, All Rights Reserved. 
 */

#ifndef _UDP_SOCKET_H_
#define _UDP_SOCKET_H_

#ifdef  _cplusplus
extern "C" {
#endif

#if defined(__RTTHREAD__) 
#include "lwip/sockets.h"
#else
#include <arpa/inet.h>
#endif

typedef struct {
    int cliendFd;
    struct sockaddr_in dstAddr;
} SocketInfo;



int CreateUdpServer(const struct sockaddr_in *sockAddr);
int CreateUdpClient(const struct sockaddr_in *sockAddr);
int UdpSocketSend(const SocketInfo *socket, const uint8_t *buffer, size_t length);
int UdpSocketRecv(int socketFd, uint8_t *buffer, size_t length);


#ifdef __cplusplus
}
#endif

#endif
